package WaiBao;

import java.util.Arrays;

public class ShiMengYue {
    public static void main(String[] args) {
        String[] name = {"典韦(班长)","鲁班(体育委员)", "小李(学习委员)","凯皇(文艺委员)", "旋风少女", "李易峰", "李文乐", "杨浩宇", "李观添", "李金波", "张富贵", "李青青",
                "杨晶晶", "蓝田玉", "李广才", "何以笙", "箫默", "小狼", "安超", "阿伟", "老黑", "大壮", "小明", "小红", "小蓝", "小金子", "李浩", "大白白",
                "王俊凯", "史梦月(学生)"};//考生本人: 史梦月(学生)
        int[] age = {21, 18, 19, 19, 18, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 19};//最后一位：考生年龄:19
//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }

        double[] H1 = {85, 92, 76, 74, 77, 69, 78, 89, 81, 80, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 95};
        double[] H2 = {87, 85, 95, 96, 68, 67, 68, 69, 80, 70, 90, 77, 66, 85, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 96};
        double[] H3 = {82, 67, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};


        double de ;//代表每个学生的总分
        double get;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            de = H1[i] + H2[i] + H3[i];
//            get = (de * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + de);
//            System.out.println(name[i] + "的平均分为:" + get);
//        }

        double J = 0,Q = 0;
        double[] XIANGYAO = new double[30];
//        for (int i = 0; i < 30; i++) {
//            J= H1[i] + H2[i] + H3[i];
//            Q= (J* 1.0) / 3;
//            XIANGYAO [i] = Q;
//        }
//
//        for (int i = 0; i <  XIANGYAO .length - 1; i++) {
//            for (int j = 0; j <  XIANGYAO .length - i - 1; j++) {
//                if (XIANGYAO [j] < XIANGYAO [j + 1]) {
//                    double tep =  XIANGYAO [j];
//                    XIANGYAO [j] = XIANGYAO [j + 1];
//                    XIANGYAO [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( XIANGYAO [i]);
//        }



        double SQ1 = 0, SQ2 = 0, SQ3 = 0;//计算每门课的平均分
        double DQ1 = 0, DQ2 = 0, DQ3 = 0;//计算每门课标准差
        double MQ1 = 0, MQ2 = 0, MQ3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < H1.length; i++) {
            he += H1[i];
        }
        SQ1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" +SQ1);
        double Sum = 0;
        for (int i = 0; i < H2.length; i++) {
            Sum += H2[i];
        }
        SQ2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + SQ2);
        double sum = 0;
        for (int i = 0; i < H3.length; i++) {
            sum += H3[i];
        }
        SQ3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + SQ3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i < H1.length; i++) {
            c1 += (H1[i] - SQ1) * (H1[i] - SQ1);
        }
        DQ1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + DQ1);
        for (int i = 0; i <H2.length; i++) {
            c2 += (H2[i] - SQ2) * (H2[i] -SQ2);
        }
        DQ2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +DQ2);

        for (int i = 0; i < H3.length; i++) {
            c3 += (H3[i] - SQ3) * (H3[i] - SQ3);
        }
        DQ3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + DQ3);
//
//        Arrays.sort(H1);
//        Arrays.sort(H2);
//        Arrays.sort(H3);
//        MQ1 = (H1[15] + H2[14]) * 1.0 / 2;
//        MQ2 = (H2[15] +H2[14]) * 1.0 / 2;
//        MQ3 = (H3[15] + H3[14]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  MQ1);
//        System.out.println("农业设施设计与制造的中位数为:" +  MQ2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  MQ3);


    }
}
